public class Example28 {
    public static void main(String[] args) {
        int[] arr = {4, 1, 6, 3, 9, 8};
        int max = getMox(arr);
        System.out.println("max=" + max);
    }

    public static int getMox(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }

    public static int getMin(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] < max) {
                max = arr[i];
            }
        }
        return max;
    }
}
 